module.exports = (app)=> {
  const DataTypes = app.Sequelize;
  return app.model.define('t_phpwarn', {
    pdi_index: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true
    },
    rs_index: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0
    },
    pdi_devid: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0
    },
    pdi_name: {
      type: DataTypes.STRING(64),
      allowNull: false,
      defaultValue: ""
    },
    pdi_type: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0
    },
    pdi_typename: {
      type: DataTypes.STRING(64),
      allowNull: false,
      defaultValue: ""
    },
    pdi_typememo: {
      type: DataTypes.STRING(255),
      allowNull: true
    },

    pdi_warnlevel: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0
    },
    pdi_warnname: {
      type: DataTypes.STRING(64),
      allowNull: false,
      defaultValue: ""
    },
    pdi_areaid: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0
    },
    pdi_areaname: {
      type: DataTypes.STRING(60),
      allowNull: false,
      defaultValue: ""
    },

    pdi_updatetime: {
      type: DataTypes.DATE,
      allowNull: true
    },
    Co_ID: {
      type: DataTypes.INTEGER,
      allowNull: true
    },
    oper_status: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 1
    }
  }, {
    tableName: 't_phpwarn',
    timestamps: false,
    underscored: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "HASH",
        fields: [
          { name: "pdi_index" },
        ]
      },
      {
        name: "pdi_index",
        unique: true,
        using: "HASH",
        fields: [
          { name: "pdi_index" },
        ]
      },
    ]
  });
};
